package com.shensi.adminCollect.service.station.impl;

import com.google.gson.Gson;
import com.shensi.adminCollect.domain.station.StationDeviceManage;
import com.shensi.adminCollect.service.station.StationDeviceAudioService;
import com.shensi.adminCollect.utils.station.Methods;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

import java.util.ArrayList;

@Service
public class StationDeviceAudioServiceImpl implements StationDeviceAudioService {

    @Override
    @Async
    public void setVoice(StationDeviceManage stationDeviceManage, Methods m) throws InterruptedException {
        //设置内置语音
        //手机号
        Gson gson = new Gson();
        m.getFreedomToken();


        ArrayList<Object> moneyUnit = new ArrayList<>();
        moneyUnit.add("元");
        moneyUnit.add(9);
        moneyUnit.add(0);
        String moneyUnitVoice = gson.toJson(moneyUnit);
        String moneyUnitVoiceRes = m.setVoice(stationDeviceManage.getDeviceNo(), moneyUnitVoice, 0, m.getFreedomToken());
        Thread.sleep(3000);
        m.getFreedomToken();


        ArrayList<Object> phone = new ArrayList<>();
        phone.add("手机尾号");
        phone.add(9);
        phone.add(0);
        String phoneVoice = gson.toJson(phone);
        String phoneRes = m.setVoice(stationDeviceManage.getDeviceNo(), phoneVoice, 1, m.getFreedomToken());
        Thread.sleep(3000);
        m.getFreedomToken();
        //加油金额
        ArrayList<Object> receivableAmtList = new ArrayList<>();
        receivableAmtList.add("加油金额");
        receivableAmtList.add(9);
        receivableAmtList.add(0);
        String receivableAmtVoice = gson.toJson(receivableAmtList);
        String receivableAmtVoiceRes = m.setVoice(stationDeviceManage.getDeviceNo(), receivableAmtVoice, 2,m.getFreedomToken());
        Thread.sleep(3000);
        m.getFreedomToken();

        //支付金额
        ArrayList<Object> amount = new ArrayList<>();
        amount.add("支付金额");
        amount.add(9);
        amount.add(0);
        String amountVoice = gson.toJson(amount);
        String amountRes = m.setVoice(stationDeviceManage.getDeviceNo(), amountVoice, 3,m.getFreedomToken());
        Thread.sleep(3000);
        m.getFreedomToken();
        //枪号
        ArrayList<Object> oilGun = new ArrayList<>();
        oilGun.add("枪号");
        oilGun.add(9);
        oilGun.add(0);
        String oilGunVoice = gson.toJson(oilGun);
        String oilGunVoiceRes = m.setVoice(stationDeviceManage.getDeviceNo(), oilGunVoice, 4,m.getFreedomToken());
        Thread.sleep(3000);
        m.getFreedomToken();
        //油品
        ArrayList<Object> oilName = new ArrayList<>();
        oilName.add("油品");
        oilName.add(9);
        oilName.add(0);
        String oilNameVoice = gson.toJson(oilName);
        String oilNameVoiceRes = m.setVoice(stationDeviceManage.getDeviceNo(), oilNameVoice, 5,m.getFreedomToken());
        Thread.sleep(3000);
        m.getFreedomToken();



        //充值金额
        ArrayList<Object> rechargeAmount = new ArrayList<>();
        rechargeAmount.add("充值金额");
        rechargeAmount.add(9);
        rechargeAmount.add(0);
        String rechargeAmountVoice = gson.toJson(rechargeAmount);
        String rechargeAmountRes = m.setVoice(stationDeviceManage.getDeviceNo(), rechargeAmountVoice, 6,m.getFreedomToken());
        Thread.sleep(3000);
        m.getFreedomToken();

        //充值金额
        ArrayList<Object> presentAmt = new ArrayList<>();
        presentAmt.add("赠送金额");
        presentAmt.add(9);
        presentAmt.add(0);
        String presentAmtVoice = gson.toJson(presentAmt);
        String presentAmtVoiceRes = m.setVoice(stationDeviceManage.getDeviceNo(), presentAmtVoice, 7,m.getFreedomToken());
        Thread.sleep(3000);
        m.getFreedomToken();




        //班结信息
        //班结
        ArrayList<Object> settle = new ArrayList<>();
        settle.add("班结信息已打印");
        settle.add(9);
        settle.add(0);
        String settleVoice = gson.toJson(settle);
        String settletRes = m.setVoice(stationDeviceManage.getDeviceNo(), settleVoice, 8, m.getFreedomToken());
        Thread.sleep(3000);
        m.getFreedomToken();

        ArrayList<Object> oilName2 = new ArrayList<>();
        oilName2.add("油品负");
        oilName2.add(9);
        oilName2.add(0);
        String oilNameVoice2 = gson.toJson(oilName2);
        String oilNameVoiceRes2 = m.setVoice(stationDeviceManage.getDeviceNo(), oilNameVoice2, 9, m.getFreedomToken());



    }
}
